<template>
  <a-config-provider
    v-if="theme"
    :theme="{
      algorithm,
    }">
    <slot />
  </a-config-provider>
  <slot v-else></slot>
</template>

<script setup lang="ts">
import { theme as antdvTheme } from 'ant-design-vue';

export interface ThemeProps {
  theme?: 'light' | 'dark';
}
const props = defineProps<ThemeProps>();

const algorithm = computed(() => {
  switch (props.theme) {
    case 'dark':
      return antdvTheme.darkAlgorithm;
    case 'light':
      return antdvTheme.defaultAlgorithm;
    default:
      return undefined;
  }
});
</script>

<style scoped></style>
